﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace CLEX.Client.Metro.ViewModel.Home
{
    public class LogoutVM : VMBase
    {
        private readonly IFacade facade;
        private readonly IPopupService popup;
        private readonly RelayCommand logout;
        private readonly RelayCommand cancel;

        public ICommand Logout
        {
            get { return logout; }
        }

        public ICommand Cancel
        {
            get { return cancel; }
        }

        public LogoutVM(IFacade facade, IPopupService popup)
        {
            this.facade = facade;
            this.popup = popup;
            this.logout = new RelayCommand(DoLogout);
            this.cancel = new RelayCommand(DoCancel);
        }

        private void DoLogout()
        {
            popup.ClosePopup();
            facade.GoToLogin();
        }

        private void DoCancel()
        {
            popup.ClosePopup();
        }
    }
}
